package com.situ.ssm.impl;

import java.util.List;

import com.situ.ssm.dao.IStudentDao;
import com.situ.ssm.dao.impl.StudentDaoImpl;
import com.situ.ssm.entity.Student;
import com.situ.ssm.service.IStudentService;
import com.situ.ssm.util.JSONResult;

public class StudentServiceImpl implements IStudentService{
	private IStudentDao studentDao = new StudentDaoImpl();

	@Override
	public List<Student> selectAll() {
		return studentDao.selectAll();
	}

	@Override
	public JSONResult selectByPage(Integer page, Integer limit) {
		int offset = (page - 1) * limit;
		List<Student> list = studentDao.selectByPage(offset, limit);
		
		int totalCount = studentDao.selectTotalCount();
		
		JSONResult jsonResult = new JSONResult(JSONResult.OK, list, totalCount);
		return jsonResult;
	}

}
